<?#//v.3.1.1
#///////////////////////////////////////////////////////
#//  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
#///////////////////////////////////////////////////////

require('../includes/config.inc.php');
include "loggedin.inc.php";

#// Delete users and banners if necessary
if(is_array($_POST[delete]) && phpa_securepost($_POST))
{
	while(list($k,$v) = each($_POST[delete]))
	{
		@mysql_query("DELETE FROM PHPAUCTIONXL_banners WHERE user=$v");
		@mysql_query("DELETE FROM PHPAUCTIONXL_bannersusers WHERE id=$v");
	}
}

#// Retrieve users from the database
$query = "SELECT * FROM PHPAUCTIONXL_bannersusers ORDER BY name";
$res_ = @mysql_query($query);
if(!$res_)
{
	print "$query<BR>".mysql_error();
	exit;
}
?>
<HTML>
<HEAD>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
</HEAD>
<bodyleftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
        <tr> 
          <td class="icono"><img src="images/ad_icon2.gif" width="22" height="22" ></td>
          <td class="breadcrumbs"><p><span><?=$MSG_25_0011?></span>&nbsp;&gt;&gt;&nbsp;<?=$MSG__0008?></p></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
    <tr> 
    <td align="center" valign="middle">
<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0 BGCOLOR="#FFFFFF">
<TR>
<TD align="center">
	<BR>
	<FORM NAME=this ACTION="<?=basename($_SERVER['PHP_SELF'])?>" METHOD=POST>
	<TABLE WIDTH="95%" BORDER="0" CELLSPACING="0" CELLPADDING="0"  class="base"  style="border:1px solid #ccc;">
	  <TR>
		<TD ALIGN=CENTER class=title>
		 <p> <? print $MSG__0008; ?></p>
		  </TD>
	  </TR>
	  <TR>
		<TD>
		  <TABLE WIDTH=100% ALIGN="CENTER" CELLPADDING=0 cellspacing="0" BGCOLOR="#dddddd">
			<TR VALIGN="TOP" BGCOLOR=white>
			  <TD COLSPAN="6" > 
				<p><A HREF="newbannersuser.php">
				<?=$MSG__0026?>
				</A></p></TD>
			</TR>
			<TR VALIGN="TOP" BGCOLOR="#eeeeee">
			  <TD WIDTH="15%">
				<?=$MSG__0021?>
				</TD>
			  <TD WIDTH="25%">
				<?=$MSG__0022?>
				</TD>
			  <TD WIDTH="28%">
				<?=$MSG__0023?>
				</TD>
			  <TD WIDTH="11%" ALIGN=CENTER>
				<?=$MSG__0025?>
				 </TD>
			  <TD WIDTH="10%" ALIGN=CENTER>
				<?=$MSG__0024?>
				</TD>
			  <TD WIDTH="11%" ALIGN=CENTER><?=$MSG_072?>
				</TD>
			</TR>
			<?
			while($row = mysql_fetch_array($res_))
			{
				#// Retriee the number of banners for this user
				$query = "SELECT id FROM PHPAUCTIONXL_banners WHERE user=$row[id]";
				$r = @mysql_query($query);
				if(!$r)
				{
					print "$query<BR>".mysql_error();
					exit;
				}
				$COUNTER = mysql_num_rows($r);
			?>
			<TR VALIGN="TOP" BGCOLOR="#ffffff">
			  <TD WIDTH="15%"> 
				<A HREF="editbannersuser.php?id=<?=$row[id]?>"><?=$row[name]?></A>
				 </TD>
			  <TD WIDTH="25%"> 
				<?=$row[company]?>
				 </TD>
			  <TD WIDTH="28%"> 
				<A HREF="mailto:<?=$row[email]?>">
				<?=$row[email]?>
				</A>  </TD>
			  <TD WIDTH="11%" ALIGN=CENTER>
				<?=$COUNTER?>
				</TD>
			  <TD WIDTH="10%" ALIGN=CENTER><A HREF="userbanners.php?id=<?=$row[id]?>"><IMG BORDER=0 SRC="./images/tools_icon2.gif"></A></TD>
			  <TD WIDTH="11%" ALIGN=CENTER> &nbsp;
				<INPUT TYPE="checkbox" NAME="delete[]" VALUE="<?=$row[id]?>">
			  </TD>
			</TR>
			<?
			}
			?>
			<TR VALIGN="TOP" ALIGN=CENTER BGCOLOR="#ffffff">
			  <TD COLSPAN="6">
				<INPUT TYPE="submit" NAME="Submit" VALUE="<?=$MSG__0028?>" class="action">
				<INPUT TYPE="hidden" NAME="security" VALUE="<?php echo $_SESSION['security'];?>" />
			  </TD>
			</TR>
		  </TABLE>
		</TD>
	  </TR>
	</TABLE>
	</FORM>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
